import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { NavLink } from 'react-router-dom';

import ContentLayout from '@/component/common/ContentLayout';
import style from '@/page/member/style.scss';
import adminType from '@/tool/adminType';
import authCheck from '@/tool/authCheck';

class Layout extends Component {
    static propTypes = {
        children: PropTypes.node,
        plusOnClick: PropTypes.func,
        loading: PropTypes.bool
    };
    render() {
        return (
            <ContentLayout navTitle="人员" loading={this.props.loading}>
                <div className={style['top-wrap']}>
                    <div className={style['top-nav']}>
                        {adminType() == 1 && <NavLink exact to="/人员" activeClassName={style['active']}>门店</NavLink>}
                        {adminType() == 1 && <NavLink exact to="/人员/经纪人" activeClassName={style['active']}>经纪人</NavLink>}
                        {adminType() != 1 && <NavLink exact to="/人员" activeClassName={style['active']}>人员</NavLink>}
                        {authCheck('员工添加', '人员') &&
                        <span className={style['top-nav-plus']}><a href="javascript:void(0);" onClick={this.props.plusOnClick} /></span>}
                    </div>
                    {this.props.children}
                </div>
            </ContentLayout>
        );
    }
}

export default Layout;